package com.weds.data_sync_api.api;

import com.weds.data_sync_api.entity.AccessRecord;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description TODO
 * @Author lihw
 * @Date 2024/3/1 10:39
 */
public interface AccessRecordSync {
    List<AccessRecord> fetchRecordByDate(LocalDate date);

    default List<AccessRecord> fetchRecordByRecordTimeBetween(LocalDateTime beginTime, LocalDateTime endTime) {
        return fetchRecordByDate(beginTime.toLocalDate()).stream().filter(s -> s.getRecordTime().isAfter(beginTime))
                .filter(s -> s.getRecordTime().isBefore(endTime)).collect(Collectors.toList());
    }

}
